package com.example.miniappssm.controller;

import com.example.miniappssm.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
public class FileController {

    @Autowired
    FileService fileService;

    /**
     * 图片上传到阿里云函数
     * @author codertao
     * @date 2022/5/20 23:46
     * @return java.lang.String
     */
    @PostMapping("/uploadImg")
    @ResponseBody
    public String uploadImg(@RequestPart("file") MultipartFile file) {
        return fileService.upload(file);
    }
}
